class_name PlayerLedgeGrabState
extends GameplayState

@onready var player: Player = $"../../../"

var animator_last_position: Vector2 = Vector2.ZERO

var offset: Vector2 = Vector2(1, 7)


func _on_enter() -> void:
	player.animator.play(&"ledge_grab")

	player.player_tag_manager.add_tag(player.player_tag_manager.State_Wall_Ledge_Grab)

	animator_last_position = player.animator.position
	player.animator.position += Vector2(offset.x * player.face_direction, offset.y)


func _on_update(_delta: float) -> void:
	player.velocity = Vector2.ZERO


func _on_exit() -> void:
	player.player_tag_manager.remove_tag(player.player_tag_manager.State_Wall_Ledge_Grab)

	player.animator.position = animator_last_position
